${page.setTitle("push-center| GOPS")}
<style type="text/css">
    .l-table-edit {}
    .l-table-edit-td{ padding:4px;}
    .l-button-submit,.l-button-reset{width:80px; float:left; margin-left:10px; padding-bottom:2px;}
</style>
${token()}
<div class="body-pla-content">
 <form action="" method="post" id="template" name="template">
 <input type="hidden" name="id" value="${template.id}"/>
<table class="l-table-edit" >
         <tr>
                <td align="right" >模板标题：</td>
                <td align="left" >
						<input name="title" type="text" id="title"  maxlength="30" value="${template.title}"  validate="{required:true,maxlength:30}"/>
				</td>
				<td align="right" >是否启用：</td>
                <td align="left" >
               			 <select name="status" id="status" v="${template.status}"  enum="template.status">
						</select>
				</td>
			 </tr> 
			  <tr>
                <td align="right" >业务优先级：</td>
                <td align="left" >
						<input name="priority" type="text" id="priority"  maxlength="30" value="${template.priority}"  validate="{required:true,maxlength:30}"/>
				</td>
				<td align="right" >分类id：</td>
                <td align="left" >
					<input type="text" name="categoryId" id="categoryId" readonly="true" value="${template.categoryId}"/>
				</td>
			 </tr> 
			 
			 <tr>
                <td align="right" >模板代码：</td>
                <td align="left" colspan=3>
					<input type="text" name="code" id="code" value="${template.code}" placeholder="必填,全库唯一,调用时用到..."/>
				</td>
			 </tr> 
			 
			  <tr>
                <td align="right" >模板配置：</td>
                <td align="left" colspan=3>
					<textarea rows="10" cols="60" name="text" id="text" >${template.text}</textarea>
				</td>
			 </tr> 
			 
			  <tr>
                <td align="right" >参数配置：</td>
                <td align="left" colspan=3>
					<textarea rows="10" cols="60" name="params" id="params" placeholder="每个参数请用逗号分隔...">${template.params}</textarea>
				</td>
			 </tr> 
			  <tr>
                <td align="right" >参数配置：</td>
                <td align="left" colspan=3>
					<textarea rows="10" cols="60" name="descr" id="descr" placeholder="每个参数请用逗号分隔(对上面参数的注释)...">${template.descr}</textarea>
				</td>
			 </tr> 
			 
             <tr>
				 <td align="right" >备注：</td>
                <td align="left" colspan=3>
                <textarea rows="3" cols="60" name="memo" id="memo" >${template.memo}</textarea>
				</td>
            </tr>  
            <tr>
            	<td></td>
            	<td colspan=3> <input type="button" value="修改" id="dosubmit" class="l-button l-button-submit"/>  </td>
            	<td align="left"></td>
            </tr>
        </table>
    </form>
</div>
<script type="text/javascript">

$(function () {
	epay_enum.iniSelect();
	$("#dosubmit").click(function(){
		var queryString = $('#template').serializeArray();  
	    $.ajax({
	        url: "${appServer}/template/update.json",   
	        data: queryString, 
	        type: "POST",
	        success: function(result) {
	        	if(result.hasError) {
					$.ligerDialog.error(result.message);
	        	}else{
	        		$.ligerDialog.success(result.message);
	        		parent.window.search();
	        		parent.$.ligerDialog.close();
	        		parent.$.ligerDialog.hide();
	        	}
	        }
	    });	
		return true;
	});

	 var category_columns = [
			{ header: 'ID', name: 'id', width: 20 },
	        { header: '分类名称', name: 'categoryName' },
	        { header: '备注', name: 'memo' }
	];
	
	 $("#categoryId").ligerComboBox(
	     {
	    	 url: "${appServer}/category/list-all.json",
	         valueField : 'id',
	         textField: 'id',
	         columns: category_columns,
	         selectBoxWidth: 400,
	         autocomplete: true,
	         width: 140
	     }
	);	
});
</script>